public class Test1 {
    //判断是否是素数
    public static void main1(String[] args) {
        int x = 7;
        int y = 2;
        for (; y < Math.sqrt(x); y++) {
            if (x % y == 0) {
                System.out.println(x + " 不是素数！");
                break;
            }
        }
        if (y > Math.sqrt(x)) {
            System.out.println(x + " 是素数！");
        }

    }

    public static void main2(String[] args) {

        //打印1到999999的水仙花数
        for (int i = 0; i <= 999999; i++){
            int count = 0;
            int sum = 0;
            int tmp = i;
            while (tmp != 0){
                count++;
                tmp /= 10;
            }
            tmp = i;
            while (tmp != 0){
                sum += Math.pow(tmp % 10,count);
                tmp /= 10;
            }
            if (sum == i){
                System.out.println(sum);
            }
        }
    }
}